/**
*@Author      ：anlzou
*@Date        ：5:53 2021/4/24
*@Github      ：https://github.com/anlzou
*@Description ：
*/
package com.anlzou.logging_Logger;

import java.util.logging.Logger;

public class LoggerDemo1 {
    public static void main(String[] args) {
        Logger.getGlobal().info("log test");

        // 查找或者创建一个Logger
        Logger logger1 = Logger.getLogger("com.anlzou.logging_Logger.LoggerDemo1");
        Logger logger2 = Logger.getLogger("com.anlzou.logging_Logger.LoggerDemo1");
        System.out.println(logger1);
        System.out.println(logger1 == logger2);
    }

    // 查找或创建一个 logger
    public static class GetLogger extends Logger{
        /**
         * Protected method to construct a logger for a named subsystem.
         * <p>
         * The logger will be initially configured with a null Level
         * and with useParentHandlers set to true.
         *
         * @param name               A name for the logger.  This should
         *                           be a dot-separated name and should normally
         *                           be based on the package name or class name
         *                           of the subsystem, such as java.net
         *                           or javax.swing.  It may be null for anonymous Loggers.
         * @param resourceBundleName name of ResourceBundle to be used for localizing
         *                           messages for this logger.  May be null if none
         *                           of the messages require localization.
         * @throws MissingResourceException if the resourceBundleName is non-null and
         *                                  no corresponding resource can be found.
         */
        protected GetLogger(String name, String resourceBundleName) {
            super(name, resourceBundleName);
        }

        // self
        public static Logger getLogger(String name) {
            return null;
        }
    }
}
